<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateHkDeviceChannelTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void 
    {
        Schema::create('hk_device_channel', function (Blueprint $table) {
            $table->engine = 'Innodb';
            $table->comment('海康设备通道');
            $table->string('device_serial', 64)->nullable(false)->comment('设备序列号');
            $table->string('channel_id', 64)->nullable(false)->comment('通道ID');
            $table->string('channel_name', 64)->nullable(false)->comment('通道名称');
            $table->string('channel_no', 64)->nullable(false)->comment('通道号');
            $table->unsignedTinyInteger('channel_status')->nullable(false)->comment('通道状态，0：离线，1：在线，-1：设备未上报');
            $table->string('channel_type')->nullable(false)->comment('通道类型，10300:视频通道，10302：报警输入');
            $table->unsignedTinyInteger('is_use')->nullable(false)->comment('通道启用状态：0-禁用；1-启用');
            $table->string('ipc_serial')->nullable(false)->comment('NVR通道关联的IPC序列号');
            $table->string('child_device_model')->nullable(false)->comment('NVR通道关联的IPC型号');
            $table->primary('device_serial');
            $table->datetimes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('hk_device_channel');
    }
}
